Many system-on-chips (SoCs) include multiple circuit modules operating at different clock frequencies. Further, an individual circuit module can also be operating at different clock frequencies depending on the state of the SoC. For example, the SoC may require certain circuit modules to be turned on and off or to be running at different clock frequencies depending on the state of the system. For example, the system can be in a power saving mode or a normal operating mode. It is often necessary to switch the source of a clock signal while the chip is running. This is usually implemented by multiplexing two different frequency clock sources in hardware and controlling the multiplexer select line by internal logic. These clock frequencies may not be synchronous with respect to each other, and they may not be synchronous with respect to clock control signals. Even when the signals are synchronous, the phase differences can create a glitch or short cycled output clock. A glitch on the clock line can affect the whole system, as it could be interpreted as a capture clock edge by some registers while missed by others.
It is therefore desirable to provide a system and method for allowing a SoC to turn on or off and switch clocks to any circuit modules on the SoC without causing any failure due to glitches in the clocking system.